package com.jyh.supermark.domain;

import java.io.Serializable;

/*
用户类
 */
public class User implements Serializable {
    private static final long serialVersionUID = 3132016647248216280L;
    private String username;//用户名
    private String password;//用户密码
    private String othername;//用户别名
    private Integer age;//用户年龄

    public User() {
    }

    public User(String username, String password, String othername, Integer age) {
        this.username = username;
        this.password = password;
        this.othername = othername;
        this.age = age;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOthername() {
        return othername;
    }

    public void setOthername(String othername) {
        this.othername = othername;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (username != null ? !username.equals(user.username) : user.username != null) return false;
        if (password != null ? !password.equals(user.password) : user.password != null) return false;
        if (othername != null ? !othername.equals(user.othername) : user.othername != null) return false;
        return age != null ? age.equals(user.age) : user.age == null;
    }

    @Override
    public int hashCode() {
        int result = username != null ? username.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (othername != null ? othername.hashCode() : 0);
        result = 31 * result + (age != null ? age.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", othername='" + othername + '\'' +
                ", age=" + age +
                '}';
    }
}
